<template>
	<view id="main">
		<log
		style="z-index: 1;"
		:mode="mode"
		@warning="warning"
		@success="success"
		@changeShow = "mode = !mode"
		></log>
		<reg
		style="z-index: 2;"
		:mode="mode"
		@warning="warning"
		@success="success"
		@changeShow = "mode = !mode"
		></reg>
		<!-- <button>点击</button> -->
		<u-toast ref="uToast" />
		<!-- toast全部放到这里!!!!!!!!reg(会隐藏) -->
	</view>
</template>

<script>
	import log from '../../components/logReg/log.vue'
	import reg from '../../components/logReg/reg.vue'
	export default {
		data() {
			return {
				mode:true
			}
		},
		onLoad() {
			// this.mode = false
			// this.makeShow()
			// this.changeShow()//打开
		},
		methods: {
			changeShow(){
				console.log('change')
				this.mode = !this.mode
			},
			warning(info){
				this.$refs.uToast.show({
					title: info,
					type: 'warning',
					position: 'top'
				})
			},
			success(info){
				this.$refs.uToast.show({
					title: info,
					type: 'success',
					position: 'top'
				})
			}
		},
		components:{
			log,reg,
		},
		watch:{
			mode(newV,oldV) {
				uni.setNavigationBarTitle({
					title: this.mode? '登录':'注册'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	#main{
		position: absolute;
		top: 0;bottom: 0px;left: 0;right: 0;
		overflow: hidden;
		
	}
</style>
